<?php
declare (strict_types = 1);

namespace app\model;

use think\Model;

/**
 * @mixin \think\Model
 * 问题表
 */
class IssueQuestion extends AppModel
{
    //



    const ISSUE_QUESTION_TYPE_ONE_STRING = '单选题';
    const ISSUE_QUESTION_TYPE_TWO_STRING = '多选题';
    const ISSUE_QUESTION_TYPE_THREE_STRING = '阅读理解';
    const ISSUE_QUESTION_TYPE_THOR_STRING = '评分题';
    const ISSUE_QUESTION_TYPE_FIVE_STRING = '判断题';

    const ISSUE_QUESTION_TYPE_ZERO = 0;
    const ISSUE_QUESTION_TYPE_ONE = 1;
    const ISSUE_QUESTION_TYPE_TWO = 2;
    const ISSUE_QUESTION_TYPE_THREE = 3;
    const ISSUE_QUESTION_TYPE_THOR = 4;
    const ISSUE_QUESTION_TYPE_FIVE = 5;

    //题目类型
    public static $issue_question_type_arr = array(
        self::ISSUE_QUESTION_TYPE_ONE_STRING => 1,
        self::ISSUE_QUESTION_TYPE_TWO_STRING => 2,
        self::ISSUE_QUESTION_TYPE_THREE_STRING => 3,
        self::ISSUE_QUESTION_TYPE_THOR_STRING => 4,
        self::ISSUE_QUESTION_TYPE_FIVE_STRING => 5,
    );


    public static $issue_question_type_arr_string = array(
        self::ISSUE_QUESTION_TYPE_ZERO => '未知',
        self::ISSUE_QUESTION_TYPE_ONE => '单选题',
        self::ISSUE_QUESTION_TYPE_TWO => '多选题',
        self::ISSUE_QUESTION_TYPE_THREE => '阅读理解',
        self::ISSUE_QUESTION_TYPE_THOR => '评分题',
        self::ISSUE_QUESTION_TYPE_FIVE => '判断题',
    );

    //关联问题答案表
    public function questionAnswers(){
        return $this->hasMany(IssueQuestionAnswer::class,'issue_question_id')->field('id,issue_answer_title,issue_answer_type,is_write,issue_question_id,jump_topic');
    }


    public function questionWrite(){
        return $this->hasMany(QuestionWrite::class,'issue_question_id');
    }
}
